UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QRAaAy2V2X/uHemD/++81BHHWLrGVXv7UcHRca7bwlg='
WHERE
key_id = 'd31dc0121c2ded725b4faee39751a562a1bf93b29ffb6de50a8986d8a7d19e8d'
AND (
token = 'QRAaAy2V2X/uHemD/++81BHHWLrGVXv7UcHRca7bwlg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)