UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pE4FdFARrV9pC5sSply7FdrSEfIL80m5RXGhw+Y85Vw='
WHERE
key_id = 'c1e037140fd841741647a4467176932b431042541a69ae4996a0e8b897add874'
AND (
token = 'pE4FdFARrV9pC5sSply7FdrSEfIL80m5RXGhw+Y85Vw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)