UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YOqub4wRCbW8vjuBGsqSnTlFu4lg5sQHK2bcQoTbf+Q=' 
WHERE 
  key_id = '9a4c9a91354b00e47ecb5981917c23492b1fa73b942316d5336a324226ec1608' 
  AND (
    token = 'YOqub4wRCbW8vjuBGsqSnTlFu4lg5sQHK2bcQoTbf+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036