UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TxvBxd95HXWtuFQ2Y4/XBmM6PoloRU7KUxMgnLt6B8Q=' 
WHERE 
  key_id = 'c76a94088d34a129b3c29646860054a41e597cb84ad2473a1467ae8f87f139e0' 
  AND (
    token = 'TxvBxd95HXWtuFQ2Y4/XBmM6PoloRU7KUxMgnLt6B8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049