UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f7f3IoqvGSTNf0SbxPotIzSx3yoDjt3pmVLUbbLGXi4='
WHERE
key_id = '0585400e92ca2bb6cfe5353d7f2e34b2a708775641beb83e1f34f846ca69eb0e'
AND (
token = 'f7f3IoqvGSTNf0SbxPotIzSx3yoDjt3pmVLUbbLGXi4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)