UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h65/fuU/ic9b86iRcksYnV94YDSJ0FwWcQXXN/khyc4=' 
WHERE 
  key_id = '9f530d4341d4a26d2b05a90a128501c32f625bd123eef1df80c6cf16c1e2d79d' 
  AND (
    token = 'h65/fuU/ic9b86iRcksYnV94YDSJ0FwWcQXXN/khyc4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042