UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4scjcGi7ITJZ3WLt1yEczC6wM06KrW11+ycFRL4Hwj4='
WHERE
key_id = '7c3c8dc784b589dcd1d9870eaf0dad255d2f18e6387c020e2df621ed8b76102a'
AND (
token = '4scjcGi7ITJZ3WLt1yEczC6wM06KrW11+ycFRL4Hwj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)