UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IccBI1ayko2pFMDabU8krGlqslXBQUJ6AL/dwF5/ekk=' 
WHERE 
  key_id = '20b54a18ed9b03230beec14d496f8d6b85bcbb437ed283a0917e8aeed3050e24' 
  AND (
    token = 'IccBI1ayko2pFMDabU8krGlqslXBQUJ6AL/dwF5/ekk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053