UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n4SCRAbvO7tBrHoFHUXkoZUkLNAQ/9ZS74R/V09ijTY='
WHERE
key_id = '8c0bfda318142a3d81a435f7850ac4f2cf50486d03849045440a7f49b90e8954'
AND (
token = 'n4SCRAbvO7tBrHoFHUXkoZUkLNAQ/9ZS74R/V09ijTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)