UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KRSY6mVTmrYQwwoI8SfjCqlf3ieCnevBvEyx/YYMme8='
WHERE
key_id = 'bcf9d37bcf353d94d3138e4c6240b4e409bbab56468202ea89fa1f2690909b45'
AND (
token = 'KRSY6mVTmrYQwwoI8SfjCqlf3ieCnevBvEyx/YYMme8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)