UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P1puuRiFRpC8tbITfz21Owc2VXJoZgfIK+6gSqiiKNw='
WHERE
key_id = '55a3e91eb5941b4e8217f40b1930b56850d8717a7289a987bb9d5360a1fedfdc'
AND (
token = 'P1puuRiFRpC8tbITfz21Owc2VXJoZgfIK+6gSqiiKNw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)