UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1m8cWxYxP5EXG0FQxGLWktbNZkYzU+kDasS61k06YUw=' 
WHERE 
  key_id = 'df9a0ea9ee31af0d5b99c57df6e91d98d98c216d0489f63dabf0661d8b2ad17e' 
  AND (
    token = '1m8cWxYxP5EXG0FQxGLWktbNZkYzU+kDasS61k06YUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045