UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AH8GRzOgvLIjeN17oVodudlL6Dbb9ZZeSxvQ+TyegDI='
WHERE
key_id = '4f87f5c7c04c4f8a7773ad60fc60811d7930593c5047b04d7147417a5d99072f'
AND (
token = 'AH8GRzOgvLIjeN17oVodudlL6Dbb9ZZeSxvQ+TyegDI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)