UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b3hdFx7Pe2Bzm6k0ULzWQ4oP02bCz5BvOkob71X/SgU=' 
WHERE 
  key_id = 'b53e9531d9101057991e867d2a075c4a99d4ccc0195e71212420390522461b37' 
  AND (
    token = 'b3hdFx7Pe2Bzm6k0ULzWQ4oP02bCz5BvOkob71X/SgU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044