UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SB+gmzf1ofbhNcY7YLG5mPeEK5hXntMLrnOdDRtV9xg='
WHERE
key_id = '96982b01a97e63a0843baa8b5b6621e74228602724d52ce96dbecf62341cb979'
AND (
token = 'SB+gmzf1ofbhNcY7YLG5mPeEK5hXntMLrnOdDRtV9xg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)