UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w1elSG45buckQc1E+zhkyeh5E/DcifB7EdASOWtgLZY=' 
WHERE 
  key_id = '470da0c8fcc6c04b84c6c4429a190ee1eac7e2f0d4a0ab0b12c9577def8b9e2c' 
  AND (
    token = 'w1elSG45buckQc1E+zhkyeh5E/DcifB7EdASOWtgLZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038