UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MnLKrbFLm5vS1T7VgWq//7c/7nOqKDFw0pbEh+tNJAw=' 
WHERE 
  key_id = '52d56c9cc22bebbba5191ed2c311efcba109f9f127e3a352c6a9e574f3309624' 
  AND (
    token = 'MnLKrbFLm5vS1T7VgWq//7c/7nOqKDFw0pbEh+tNJAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032