UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0X7IvGoJXM+lNmn/Se6+pa2XDdNTKTUrn5SbKUUHoYc=' 
WHERE 
  key_id = '4b037dd1c713e344107db30d4d9f5789e81b03637c773bd51adda711669697d6' 
  AND (
    token = '0X7IvGoJXM+lNmn/Se6+pa2XDdNTKTUrn5SbKUUHoYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017