UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T0yzsE6TFWqi7MUNUxVm1+5eUeBWNxloikf6BrSbr+I='
WHERE
key_id = 'e7f9e4074e592e71c6ce4a05fb37c149af9d6a64b3f816e9d78665dfda539faf'
AND (
token = 'T0yzsE6TFWqi7MUNUxVm1+5eUeBWNxloikf6BrSbr+I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)