UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZKQAtxVp+fhbPblOGUAaAbUGeqYWxipJy2mxJRZ7YwI=' 
WHERE 
  key_id = '4407258cd2370ebd31321df2cd8af9d4166d7e8811741aad570fe68ea35fc8d4' 
  AND (
    token = 'ZKQAtxVp+fhbPblOGUAaAbUGeqYWxipJy2mxJRZ7YwI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025