UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x4t9B65YiBcPjAqi5zkeGB8itSkEHPSzrpXwDwoL4zQ='
WHERE
key_id = '03be3d244dae18c5e1fcf4e98bbfde41efbbdc743b96da27febf689f44833625'
AND (
token = 'x4t9B65YiBcPjAqi5zkeGB8itSkEHPSzrpXwDwoL4zQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)