UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N3BYEgUwXeHI6ray60BFBteLtBrf0hj60+lzs9o1Q6g=' 
WHERE 
  key_id = '72e763233bc90ff61c192bcb291073cb3642017267ede3747c2e1aed63f55264' 
  AND (
    token = 'N3BYEgUwXeHI6ray60BFBteLtBrf0hj60+lzs9o1Q6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021