UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cS6zzicAr0NGOM3LIMFVvIUp7eyLLBvCiw6iB/wNNgw='
WHERE
key_id = 'b82819ebea11a5fef73d0e444092fd683e31ffe013dd42168afb344d5659f08b'
AND (
token = 'cS6zzicAr0NGOM3LIMFVvIUp7eyLLBvCiw6iB/wNNgw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)