UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BwKko1dhqUo1qWc+/PKqgpcycrbSHoxbNak5EepipKo=' 
WHERE 
  key_id = '96b2f98ad6378b0337d7e9332708490f65c8c9721aa4d5c2421df84b4083e2f1' 
  AND (
    token = 'BwKko1dhqUo1qWc+/PKqgpcycrbSHoxbNak5EepipKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030