UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'owPs1b27OcV8AL0XIxEnXh7XkezlrJyelEYAZZTTdwE='
WHERE
key_id = 'cddf0b794e883dab8a523fd2efda8e2c4ffde1fd7251ba01efb0ce1e2e1aa082'
AND (
token = 'owPs1b27OcV8AL0XIxEnXh7XkezlrJyelEYAZZTTdwE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)