UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ctJhIlBsd88StjLbAHeTIbpXec8sG7EogXlcRLzACh8=' 
WHERE 
  key_id = '8ddab488365e45b88478f099787b3de1cccdada0c1690907b2cd8bf63dde94b9' 
  AND (
    token = 'ctJhIlBsd88StjLbAHeTIbpXec8sG7EogXlcRLzACh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043