UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E5Znt2MzKk88ays0rKwkpwI+9dcXbOVRFbLCPU22Zyw='
WHERE
key_id = 'a3f9a9320ed59391b1b82a15bb5aaaf0b3463c01a8a1939bbc0a24d98175c0c6'
AND (
token = 'E5Znt2MzKk88ays0rKwkpwI+9dcXbOVRFbLCPU22Zyw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)