UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TNOq/pWV0BzMVOMlvzF+MjhJZoS7XBeyZ13bwAXpyj0=' 
WHERE 
  key_id = '6d388df4beb3b3b2b9bd254942e8ea9deb4316c79aa133e56f8f566b3ed12b73' 
  AND (
    token = 'TNOq/pWV0BzMVOMlvzF+MjhJZoS7XBeyZ13bwAXpyj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016