UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KUrd9oWnSxyQAM1NrQNHVw0Nru3+jsux+Rj1Dp04vvU='
WHERE
key_id = 'd8dc23650c2d15a895baabeadf2a1ec062bc8c4f5a4e8a5bbc656e25801b4cc4'
AND (
token = 'KUrd9oWnSxyQAM1NrQNHVw0Nru3+jsux+Rj1Dp04vvU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)