UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hCZtaD8ZFo1rKlG2aaNA5RqeL+GpN/hPQWD/QQm9FOM='
WHERE
key_id = 'a2543d1dab2888aa11d3bad96150c5285b2abf387bdfe74c5e58a47cc502aff8'
AND (
token = 'hCZtaD8ZFo1rKlG2aaNA5RqeL+GpN/hPQWD/QQm9FOM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)