UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ryGZRm3ptaG+4QuufdOasvQ/a3B22AJ0AnrSfX/IU4U='
WHERE
key_id = 'e87c6ae125d682400b7ecb6e6603438b90a327c1124e86ed73abad060e568032'
AND (
token = 'ryGZRm3ptaG+4QuufdOasvQ/a3B22AJ0AnrSfX/IU4U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)