UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ziWZn6D028L09g6Yd313W0EzIwNr2w3n0yDQnXKGysA=' 
WHERE 
  key_id = 'ce0bf4f2a58745996cd34b9f76c0681d1f8ad9eeb140b71a72e9ecb97f7300c9' 
  AND (
    token = 'ziWZn6D028L09g6Yd313W0EzIwNr2w3n0yDQnXKGysA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031