UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ay4Ezu5EDQZj7pPShl69tTd4IU3MLo0XhGTyk16A4wY='
WHERE
key_id = '23e31027a59860c0de459e47be3a8505494f16fa1877686aa2a8c9b05c246869'
AND (
token = 'ay4Ezu5EDQZj7pPShl69tTd4IU3MLo0XhGTyk16A4wY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)