UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sDqNi1NT/Jm0izLeyFe7RSYl6WwzFRFSnGzEbRzZIaI='
WHERE
key_id = 'ca01d291f44030c05d60426d9d35df3c7e53fc65ed958afe90171e7f6e58a368'
AND (
token = 'sDqNi1NT/Jm0izLeyFe7RSYl6WwzFRFSnGzEbRzZIaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)