UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iD2g3JA1WLezrXtv+m5Bv1gWRTMiiP+3xjLPVCJF0rg='
WHERE
key_id = 'b6cdab4a84060a5751ea144c0bc2bcd3441a55a3e4ccd90b8f0cd037f815afa1'
AND (
token = 'iD2g3JA1WLezrXtv+m5Bv1gWRTMiiP+3xjLPVCJF0rg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)